package com.xiangyun.exception;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletResponse;
@ControllerAdvice
public class CustomExceptionHandler {
    @ExceptionHandler(Exception.class)
    @ResponseBody
    public ModelAndView uploadException(Exception e){
        ModelAndView mv = new ModelAndView();
        mv.addObject("msg","上传文件大小超出限制");
        mv.setViewName("/WEB-INF/page/error.jsp");
        return mv;
    }
}
